﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using Ppt = Microsoft.Office.Interop.PowerPoint;

namespace ObjectModel.PowerPoint
{
    /// <summary>
    /// A PowerPoint shape object that can resolve itself from serializable info.
    /// </summary>
    public class ResolvableShape : ResolvableObject
    {
        public ResolvableSlide Slide { get; set; }
        
        public int ShapeId { get; set; }

        public ResolvableShape() { } // Parameterless constructor required for serialization.
        
        public ResolvableShape(Ppt.Shape shape)
        {
            Slide = new ResolvableSlide(shape.GetSlide());
            ShapeId = shape.Id;
        }
        
        public override object Resolve()
        {
            Ppt.Slide slide = Slide.Resolve() as Ppt.Slide;
            return slide.Shapes.FindById(ShapeId);
        }
    }
}
